/**
 * Copyright 2014 the original author or authors. All rights reserved.
 */
package com.visionet.security.utils;

import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;

import com.visionet.jumper.core.exception.runtime.FrameworkException;

/**
 * 
 *
 * @author suxiaojing
 * @date
 * @since 0.0.1
 */
public class CodecUtils {
	/**
	 * @param data
	 * @return
	 */
	public static String encodeHexString(byte[] data) {
		return Hex.encodeHexString(data);
	}

	/**
	 * @param data
	 * @return
	 */
	public static byte[] decodeStringHex(String data) {
		try {
			return Hex.decodeHex(data.toCharArray());
		} catch (DecoderException e) {
			throw new FrameworkException(e.getMessage(), e);
		}
	}
}
